package com.derbysoft.ota.application.translator.rq;

import com.derbysoft.modules.eip.translator.Translator;
import com.derbysoft.ota.application.util.RequestorIDs;
import com.derbysoft.ota.interfaces.protocol._2009a.POSType;
import com.derbysoft.ota.interfaces.protocol._2009a.SourceType.RequestorID;
import com.derbysoft.remote.dswitch.core.RequestHeader;
import com.derbysoft.remote.dswitch.core.factory.RequestHeaderFactory;
import com.derbysoft.remote.dswitch.generic.constants.UniqueIDType;
import com.google.inject.internal.Maps;

public class RequestHeaderTranslator implements Translator<POSType, RequestHeader> {


	@Override
	public RequestHeader translate(POSType source) {
		RequestorID requestorID = RequestorIDs.of(source);
		RequestHeader requestHeader = RequestHeaderFactory.createRequestHeader(
				requestorID.getID(),
				UniqueIDType.TRAVEL_AGENCY,
				Maps.<String, UniqueIDType>newHashMap(),
				Maps.<String, UniqueIDType>newHashMap()
		);
		requestHeader.setSourceCredential(requestorID.getMessagePassword());
		return requestHeader;
	}

}
